<?php 
require_once("includes/config.php"); 
  
  $additonalLink[0] = ' <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCPEV5DEZb8LVtsmBtXxnPeThKBUK1jW8c&sensor=false"></script>';
  $additonalLink[1] = ' <script src="js/infobox.js" type="text/javascript"></script>';
  $additonalLink[2] = " <script src='js/jquery.tools.min.js' type='text/javascript' language='javascript'></script>";
$owners= query("SELECT * FROM apartments_owner WHERE id = ?",$_SESSION['user_id']);
foreach($owners as $owner){
$owner_data["first_name"] = $owner['first_name'];
$owner_data["last_name"]= $owner['last_name'];
$owner_data["username"]= $owner['username'];
$owner_data["email"] = $owner['email'] ;

}
if($_SERVER["REQUEST_METHOD"] == "POST"){
$username = $_POST['username'];
$password = $_POST['password'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];

$update= query("UPDATE apartments_owner SET first_name =? ,last_name=? ,username=? ,email = ? WHERE id =?",$first_name,$last_name,$username,$email,$_SESSION['user_id']);
  $_SESSION['success_message']="تم الحفظ";
}
render("view_profile.php", array("title"=>"الملف الشخصى" ,"owner_data"=>$owner_data));

?>